<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>心情盒子 | 每日情绪记录</title>
    <!-- 引入微信设计规范字体（苹方） -->
    <link rel="stylesheet" href="https://at.alicdn.com/t/c/font_3777530_8b8u8q5vq8.css">
    <!-- 引入FontAwesome图标库 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
    <style>
        :root {
            /* 微信小程序设计规范主色 */
            --primary-color: #1AAD19;
            --light-primary: #E6F4EA;
            --text-primary: #333;
            --text-secondary: #666;
            --bg-light: #F8F8F8;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
            background-color: #F5F5F5;
            color: var(--text-primary);
        }

        .container {
            max-width: 414px;
            margin: 0 auto;
            min-height: 100vh;
            background-color: white;
            position: relative;
            padding-top: 68px; /* 状态栏+导航栏高度 */
        }

        /* 底部导航栏 */
        .top-navbar {
            position: fixed;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100%;
            max-width: 414px;
            height: 54px;
            background: #fff;
            border-radius: 18px 18px 0 0;
            box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
            display: flex;
            align-items: center;
            justify-content: space-around;
            z-index: 100;
        }

        .top-navbar .nav-btn {
            flex: 1;
            text-align: center;
            background: none;
            border: none;
            outline: none;
            font-size: 15px;
            color: var(--text-secondary);
            padding: 8px 0 0 0;
            cursor: pointer;
            border-radius: 18px 18px 0 0;
            transition: color 0.18s, background 0.18s;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
        }

        .top-navbar .nav-btn.active {
            color: var(--primary-color);
            font-weight: 600;
            background: var(--light-primary);
        }

        .top-navbar .nav-btn i {
            font-size: 20px;
            margin-bottom: 2px;
        }

        /* 页面内容区底部留白，防止被导航栏遮挡 */
        .page {
            display: none;
            padding: 24px 24px 70px 24px; /* 底部留白 */
            height: 100%;
        }

        .page.active {
            display: block;
        }

        /* 登录页优化 */
        #login-page {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: calc(100vh - 68px);
            height: 100%;
            padding: 0;
            position: relative;
        }
        .login-content {
            width: 100%;
            max-width: 320px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: none;
            padding: 32px 0 32px 0;
            box-sizing: border-box;
        }
        .login-content .logo {
            width: 80px;
            height: 80px;
            background: var(--light-primary);
            border-radius: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 28px;
        }
        .login-content .logo i {
            color: var(--primary-color);
            font-size: 40px;
        }
        .login-content h1 {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 10px;
            text-align: center;
        }
        .login-content p {
            color: var(--text-secondary);
            font-size: 15px;
            margin-bottom: 38px;
            text-align: center;
        }
        .login-content #login-btn {
            width: 100%;
            max-width: 240px;
            display: block;
            margin: 0 auto;
            background: var(--primary-color);
            color: white;
            border: none;
            padding: 12px 32px;
            border-radius: 32px;
            font-size: 16px;
            font-weight: 500;
            box-shadow: 0 4px 12px rgba(26, 173, 25, 0.2);
            transition: transform 0.2s;
        }
        .login-content #login-btn:active {
            transform: scale(0.98);
        }

        /* 首页优化 */
        #home-page {
            padding-top: 0;
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
        }

        .header h2 {
            font-size: 20px;
            font-weight: 600;
        }

        #record-btn {
            background: var(--light-primary);
            color: var(--primary-color);
            border: none;
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 14px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 0;
        }

        .history-list {
            list-style: none;
            margin-bottom: 32px;
        }

        .history-item {
            display: flex;
            align-items: center;
            gap: 16px;
            padding: 16px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            margin-bottom: 12px;
            cursor: pointer;
            transition: box-shadow 0.2s;
            position: relative;
        }

        .history-item:hover {
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }

        .history-item .date {
            color: var(--text-secondary);
            font-size: 12px;
            margin-bottom: 4px;
        }

        .history-item .content {
            flex: 1;
            font-size: 14px;
            line-height: 1.4;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .history-item .emotion-tag {
            background: var(--light-primary);
            color: var(--primary-color);
            padding: 4px 12px;
            border-radius: 16px;
            font-size: 12px;
            white-space: nowrap;
        }

        .week-report-entry {
            width: 100%;
            display: flex;
            justify-content: center;
            margin: 0 0 18px 0;
        }
        .week-report-btn {
            background: var(--primary-color);
            color: #fff;
            border: none;
            border-radius: 22px;
            font-size: 16px;
            font-weight: 500;
            padding: 10px 32px;
            box-shadow: 0 2px 8px rgba(26,173,25,0.10);
            cursor: pointer;
            transition: background 0.18s;
        }
        .week-report-btn:hover {
            background: #179b16;
        }
        /* 一周报告页面 */
        #week-report-page {
            padding-top: 0;
            text-align: center;
        }
        .week-report-card {
            background: var(--light-primary);
            padding: 24px;
            border-radius: 16px;
            margin: 24px 0;
        }
        .week-trend {
            margin: 18px 0 18px 0;
            font-size: 15px;
            color: var(--primary-color);
        }
        .week-tags {
            margin: 12px 0 0 0;
        }
        .week-tag {
            display: inline-block;
            background: #e6f4ea;
            color: #1aad19;
            border-radius: 16px;
            padding: 6px 16px;
            margin: 0 4px 8px 4px;
            font-size: 15px;
        }
        .week-summary {
            color: #666;
            font-size: 15px;
            margin-top: 18px;
        }

        /* 记录页优化 */
        #record-page {
            padding-top: 0;
        }

        .record-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
        }

        #back-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 20px;
            cursor: pointer;
            margin-top: 0;
        }

        .input-group {
            margin-bottom: 24px;
        }

        #text-input {
            width: 100%;
            height: 180px;
            padding: 16px;
            border: 1px solid #EEE;
            border-radius: 12px;
            resize: none;
            font-size: 16px;
            line-height: 1.6;
            font-family: "PingFang SC", sans-serif;
        }

        #text-input::placeholder {
            color: #999;
        }

        .media-buttons {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 12px;
            margin-bottom: 32px;
        }

        .media-btn {
            background: white;
            border: 1px solid #EEE;
            padding: 16px;
            border-radius: 12px;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            transition: all 0.2s;
        }

        .media-btn:hover {
            background: var(--bg-light);
            border-color: var(--primary-color);
        }

        .media-btn i {
            color: var(--primary-color);
            font-size: 24px;
        }

        .media-btn span {
            color: var(--text-secondary);
            font-size: 14px;
        }

        #submit-btn {
            background: var(--primary-color);
            color: white;
            border: none;
            padding: 14px;
            border-radius: 32px;
            font-size: 16px;
            font-weight: 500;
            width: 100%;
            margin-bottom: 24px;
            box-shadow: 0 4px 12px rgba(26, 173, 25, 0.2);
            transition: transform 0.2s;
        }

        #submit-btn:active {
            transform: scale(0.98);
        }

        /* 报告页优化 */
        #report-page {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            min-height: calc(100vh - 68px - 54px);
            padding: 0 0 40px 0;
        }
        .report-illustration {
            width: 120px;
            height: 120px;
            margin: 32px auto 10px auto;
        }
        .report-illustration img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .report-card {
            background: var(--light-primary);
            padding: 28px 22px 22px 22px;
            border-radius: 18px;
            margin: 0 auto 32px auto;
            max-width: 380px;
            width: 100%;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            box-shadow: 0 2px 12px rgba(26,173,25,0.06);
        }
        .report-card .emotion-tag {
            background: var(--primary-color);
            color: white;
            padding: 6px 18px;
            border-radius: 18px;
            font-size: 15px;
            margin-bottom: 14px;
            display: inline-block;
        }
        .report-card h3 {
            font-size: 20px;
            font-weight: 700;
            margin-bottom: 10px;
            text-align: left;
            color: #222;
        }
        .report-card p {
            color: var(--text-secondary);
            font-size: 15px;
            line-height: 1.7;
            margin-bottom: 0;
            text-align: left;
        }
        #back-home-btn {
            background: var(--primary-color);
            color: white;
            border: none;
            padding: 13px 0;
            border-radius: 32px;
            font-size: 16px;
            font-weight: 600;
            margin: 32px auto 0 auto;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(26, 173, 25, 0.13);
            transition: background 0.18s, transform 0.18s;
            display: block;
            width: 80%;
            max-width: 320px;
        }
        #back-home-btn:hover {
            background: #179b16;
        }

        /* 我的页面 */
        #profile-page {
            text-align: center;
            padding-top: 32px;
        }

        .profile-avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: var(--light-primary);
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 16px auto;
        }

        .profile-avatar i {
            font-size: 38px;
            color: var(--primary-color);
        }

        .profile-nickname {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 8px;
        }

        .profile-desc {
            color: var(--text-secondary);
            font-size: 14px;
            margin-bottom: 24px;
        }

        #logout-btn {
            background: #fff;
            color: var(--primary-color);
            border: 1px solid var(--primary-color);
            padding: 12px 32px;
            border-radius: 32px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
        }

        #logout-btn:hover {
            background: var(--light-primary);
        }

        /* 微信小程序顶栏样式 */
        .wx-statusbar, .wx-navbar {
            width: 100%;
            max-width: 414px;
            margin: 0 auto;
            left: 0;
            right: 0;
            position: fixed;
            top: 0;
            z-index: 1000;
        }
        .wx-statusbar {
            height: 24px;
            background: #F8F8F8;
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 12px;
            color: #888;
            padding: 0 12px;
            box-sizing: border-box;
            letter-spacing: 0.5px;
            border-top-left-radius: 0;
            border-top-right-radius: 0;
        }
        .wx-navbar {
            height: 44px;
            background: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            border-bottom: 1px solid #f0f0f0;
            font-size: 18px;
            font-weight: 600;
            color: #222;
            letter-spacing: 1px;
            position: fixed;
            top: 24px;
            left: 0;
            right: 0;
            z-index: 1001;
            box-sizing: border-box;
        }
        .wx-navbar-title {
            width: 100%;
            text-align: center;
        }
        .container {
            max-width: 414px;
            margin: 0 auto;
            min-height: 100vh;
            background-color: white;
            position: relative;
            padding-top: 68px;
        }
        @media (max-width: 480px) {
            .wx-statusbar, .wx-navbar, .container { max-width: 100vw; }
        }
        #back-home-btn2 {
            background: var(--primary-color);
            color: white;
            border: none;
            padding: 12px 32px;
            border-radius: 32px;
            font-size: 16px;
            font-weight: 500;
            margin-top: 24px;
            cursor: pointer;
            box-shadow: 0 4px 12px rgba(26, 173, 25, 0.2);
            transition: background 0.18s, transform 0.18s;
            display: inline-block;
        }
        #back-home-btn2:hover {
            background: #179b16;
        }
    </style>
</head>

<body>
    <!-- 微信小程序顶栏 -->
    <div class="wx-statusbar">
        <span>9:41</span>
        <span>
            <i class="fa-solid fa-signal"></i>
            <i class="fa-solid fa-wifi"></i>
            <i class="fa-solid fa-battery-full"></i>
        </span>
    </div>
    <div class="wx-navbar"><span class="wx-navbar-title" id="wxNavbarTitle">心情盒子</span></div>
    <div class="container">
        <!-- 底部导航栏 -->
        <div class="top-navbar">
            <button class="nav-btn active" id="tab-home" onclick="switchTab('home')">
                <i class="fa-solid fa-house-chimney"></i>
                首页
            </button>
            <button class="nav-btn" id="tab-profile" onclick="switchTab('profile')">
                <i class="fa-regular fa-user"></i>
                我的
            </button>
        </div>
        <!-- 登录页 -->
        <div class="page" id="login-page">
            <div class="login-content">
                <div class="logo"><i class="fa-solid fa-heart-circle-check"></i></div>
                <h1>心情盒子</h1>
                <p>记录每日情绪，遇见更懂自己的你</p>
                <button id="login-btn">微信一键登录</button>
            </div>
        </div>
        <!-- 首页 -->
        <div class="page" id="home-page">
            <div class="header">
                <h2>我的情绪记录</h2>
                <button id="record-btn">
                    <i class="fa-solid fa-pen-to-square"></i> 记录心情
                </button>
            </div>
            <ul class="history-list">
                <li class="history-item" onclick="viewReport('2024-10-01 18:30', '今天和朋友去野餐，阳光很好，大家一起烤了红薯，超开心～', '开心')">
                    <div>
                        <p class="date">2024-10-01 18:30</p>
                        <p class="content">今天和朋友去野餐，阳光很好，大家一起烤了红薯，超开心～</p>
                    </div>
                    <span class="emotion-tag">开心</span>
                </li>
                <li class="history-item" onclick="viewReport('2024-09-30 22:15', '项目 deadline 快到了，今天加班到十点，有点累但很充实～', '平静')">
                    <div>
                        <p class="date">2024-09-30 22:15</p>
                        <p class="content">项目 deadline 快到了，今天加班到十点，有点累但很充实～</p>
                    </div>
                    <span class="emotion-tag">平静</span>
                </li>
            </ul>
            <div class="week-report-entry">
              <button class="week-report-btn" onclick="showWeekReport()"><i class="fa-solid fa-chart-line"></i> 一周情绪报告</button>
            </div>
        </div>
        <!-- 记录页 -->
        <div class="page" id="record-page">
            <div class="record-header">
                <button id="back-btn"><i class="fa-solid fa-chevron-left"></i></button>
                <h2>记录今日心情</h2>
                <span></span>
            </div>
            <div class="input-group">
                <textarea id="text-input" placeholder="今天有什么想分享的？文字会帮助AI更准确分析你的情绪哦～"></textarea>
            </div>
            <div class="media-buttons">
                <button class="media-btn">
                    <i class="fa-solid fa-camera"></i>
                    <span>拍张自拍</span>
                </button>
                <button class="media-btn">
                    <i class="fa-solid fa-microphone"></i>
                    <span>录制语音</span>
                </button>
            </div>
            <button id="submit-btn">生成情绪报告</button>
        </div>
        <!-- 报告页 -->
        <div class="page" id="report-page">
            <div class="report-illustration">
                <img src="https://cdn-icons-png.flaticon.com/512/3974/3974932.png" alt="情绪报告">
            </div>
            <div class="report-card">
                <span class="emotion-tag">开心</span>
                <h3>今日情绪诊断：元气小太阳</h3>
                <p>你的文字充满温暖，自拍中洋溢着笑容，语音语调轻快～今天的你像一颗小太阳，温暖了自己也温暖了周围的人！</p>
            </div>
            <button id="back-home-btn">返回首页</button>
        </div>
        <!-- 我的页面 -->
        <div class="page" id="profile-page">
            <div class="profile-avatar"><i class="fa-regular fa-user"></i></div>
            <div class="profile-nickname">微信用户</div>
            <div class="profile-desc">欢迎使用心情盒子，记录你的每一天。</div>
            <button id="logout-btn">退出登录</button>
        </div>
        <!-- 一周情绪报告页面 -->
        <div class="page" id="week-report-page">
            <div class="report-illustration">
                <img src="https://cdn-icons-png.flaticon.com/512/3974/3974932.png" alt="一周情绪报告">
            </div>
            <div class="week-report-card">
                <div class="week-trend"><i class="fa-solid fa-chart-line"></i> 本周情绪趋势：平稳向好</div>
                <div class="week-tags">
                    <span class="week-tag">开心 3天</span>
                    <span class="week-tag">平静 2天</span>
                    <span class="week-tag">压力 1天</span>
                    <span class="week-tag">充实 1天</span>
                </div>
                <div class="week-summary">
                    AI总结：你本周整体情绪积极，偶有压力但能及时调整，继续保持良好心态！<br>
                    建议：多关注自己的情绪波动，适当放松，保持与朋友的交流。
                </div>
            </div>
            <button id="back-home-btn2">返回首页</button>
        </div>
    </div>
    <script>
        const loginBtn = document.getElementById('login-btn');
        const recordBtn = document.getElementById('record-btn');
        const submitBtn = document.getElementById('submit-btn');
        const backBtn = document.getElementById('back-btn');
        const backHomeBtn = document.getElementById('back-home-btn');
        const logoutBtn = document.getElementById('logout-btn');
        const pages = document.querySelectorAll('.page');
        const tabHome = document.getElementById('tab-home');
        const tabProfile = document.getElementById('tab-profile');

        function showPage(pageId) {
            pages.forEach(page => {
                page.classList.remove('active');
                page.style.display = 'none';
            });
            const targetPage = document.getElementById(pageId);
            if (targetPage) {
                targetPage.classList.add('active');
                targetPage.style.display = 'block';
            }
        }

        function switchTab(tab) {
            if (tab === 'home') {
                tabHome.classList.add('active');
                tabProfile.classList.remove('active');
                showPage('home-page');
                document.getElementById('wxNavbarTitle').innerText = '我的情绪记录';
            } else if (tab === 'profile') {
                tabProfile.classList.add('active');
                tabHome.classList.remove('active');
                showPage('profile-page');
                document.getElementById('wxNavbarTitle').innerText = '我的';
            }
        }

        document.addEventListener('DOMContentLoaded', () => {
            showPage('login-page');
            document.getElementById('wxNavbarTitle').innerText = '心情盒子';
            if (loginBtn) {
                loginBtn.addEventListener('click', () => {
                    showPage('home-page');
                    tabHome.classList.add('active');
                    tabProfile.classList.remove('active');
                    document.getElementById('wxNavbarTitle').innerText = '我的情绪记录';
                });
            }
            if (recordBtn) {
                recordBtn.addEventListener('click', () => showPage('record-page'));
            }
            if (backBtn) {
                backBtn.addEventListener('click', () => showPage('home-page'));
            }
            if (submitBtn) {
                submitBtn.addEventListener('click', () => showPage('report-page'));
            }
            if (backHomeBtn) {
                backHomeBtn.addEventListener('click', () => showPage('home-page'));
            }
            if (logoutBtn) {
                logoutBtn.addEventListener('click', () => {
                    showPage('login-page');
                    tabHome.classList.add('active');
                    tabProfile.classList.remove('active');
                    document.getElementById('wxNavbarTitle').innerText = '心情盒子';
                });
            }
        });
        // 记录页和报告页切换时，导航栏标题恢复默认
        if (recordBtn) {
            recordBtn.addEventListener('click', () => {
                document.getElementById('wxNavbarTitle').innerText = '我的情绪记录';
            });
        }
        if (backBtn) {
            backBtn.addEventListener('click', () => {
                document.getElementById('wxNavbarTitle').innerText = '我的情绪记录';
            });
        }
        if (submitBtn) {
            submitBtn.addEventListener('click', () => {
                document.getElementById('wxNavbarTitle').innerText = '心情盒子';
            });
        }
        if (backHomeBtn) {
            backHomeBtn.addEventListener('click', () => {
                document.getElementById('wxNavbarTitle').innerText = '我的情绪记录';
            });
        }
        // 查看单条记录报告
        function viewReport(date, content, emotion) {
            showPage('report-page');
            var tag = document.querySelector('#report-page .emotion-tag');
            var title = document.querySelector('#report-page h3');
            var desc = document.querySelector('#report-page p');
            if (tag) tag.innerText = emotion;
            if (title) {
                if (emotion === '开心') title.innerText = '今日情绪诊断：元气小太阳';
                else if (emotion === '平静') title.innerText = '今日情绪诊断：平和如水';
                else title.innerText = '今日情绪诊断';
            }
            if (desc) {
                if (emotion === '开心') desc.innerText = '你的文字充满温暖，今天的你像一颗小太阳，温暖了自己也温暖了周围的人！';
                else if (emotion === '平静') desc.innerText = '你今天很平静，内心安稳，继续保持良好心态哦～';
                else desc.innerText = '希望你每天都能记录真实的自己，AI会陪你一起成长。';
            }
            document.getElementById('wxNavbarTitle').innerText = '心情盒子';
        }
        // 跳转一周报告
        function showWeekReport() {
            showPage('week-report-page');
            document.getElementById('wxNavbarTitle').innerText = '一周情绪报告';
        }
        // 一周报告返回首页
        var backHomeBtn2 = document.getElementById('back-home-btn2');
        if (backHomeBtn2) {
            backHomeBtn2.addEventListener('click', function() {
                showPage('home-page');
                document.getElementById('wxNavbarTitle').innerText = '我的情绪记录';
            });
        }
    </script>
</body>

</html>